package Array;

import org.junit.Test;

/**
 * @BelongsProject: SeniorArchitect-LeetCode
 * @BelongsPackage: Array
 * @Author: zhuangxiaoyan
 * @CreateTime: 2023-11-26  10:45
 * @Description: TODO
 * @Version: 1.0
 */
public class 检查矩阵 {

    public boolean areSimilar(int[][] mat, int k) {

        for (int[] array : mat) {
            for (int i = 0; i < array.length; i++) {
                int index=(i + k) % array.length;
                if (array[i] != array[index]) {
                    return false;
                }
            }
        }
        return true;
    }

    @Test
    public void test() {
//        boolean b = areSimilar(new int[][]{{1, 2, 1, 2}, {5, 5, 5, 5}, {6, 3, 6, 3}}, 2);
//        boolean c = areSimilar(new int[][]{{2, 2}, {2,2,}}, 3);
        boolean e = areSimilar(new int[][]{{9, 1, 8, 9, 2, 9, 1, 8, 9, 2}, {10, 2, 7, 8, 9, 10, 2, 7, 8, 9}, {7, 6, 6, 9, 5, 7, 6, 6, 9, 5}}, 5);
        boolean f = areSimilar(new int[][]{{4, 9, 10, 10}, {9, 3, 8, 4}, {2, 5, 3, 8}, {6, 1, 10, 4}}, 5);
//        System.out.println(b);
//        System.out.println(c);
        System.out.println(e);
        System.out.println(f);
    }
}
